package com.project.class4_8.proxy2.service.impl;

import com.project.class4_8.proxy2.bean.OutBean;
import com.project.class4_8.proxy2.dao.IOutDao;
import com.project.class4_8.proxy2.dao.ISaveDao;
import com.project.class4_8.proxy2.dao.impl.OutDaoImpl;
import com.project.class4_8.proxy2.dao.impl.SaveDaoImpl;
import com.project.class4_8.proxy2.service.IOutService;

/**
 * 出库业务实现类
 */
public class OutServiceImpl implements IOutService {
    private ISaveDao saveDao = new SaveDaoImpl();
    private IOutDao outDao = new OutDaoImpl();
    @Override
    public void addOut(OutBean out) {

        outDao.add(out);
        saveDao.updateNum(out.getProductId(),out.getNum());
    }

    public static void main(String[] args) {
        ServiceProxy proxy = new ServiceProxy(new OutServiceImpl());
        IOutService service = (IOutService) proxy.getProxy();
        service.addOut(new OutBean("3",10));
    }
}
